layui.use(['element','laypage', 'layer','carousel', 'form'], function(){
    var element = layui.element;
    var laypage = layui.laypage
        ,layer = layui.layer;
    var carousel = layui.carousel
        ,form = layui.form;


    //建造实例
    carousel.render({
        elem: '#carousel'
        ,width: '100%' //设置容器宽度
        ,height:'220px'
        ,arrow: 'always' //始终显示箭头
        //,anim: 'updown' //切换动画方式
    });

    /**
     * 导航栏菜单高亮显示
     */
    var type = $("#type").val();
    $("#menu"+type).css("color","#45B6F7");
    $("#menu"+type).addClass("layui-this");

    $(".newBtn").hover(function(){
        $(this).css("background-color","#1E9FFF");// 鼠标悬浮时触发
        $(this).css("color","white");// 鼠标悬浮时触发

        $(".monthBtn").css("background-color","unset");
        $(".monthBtn").css("color","unset");

        $("#newList").css("display","unset");
        $("#monthList").css("display","none");
    })

    $(".monthBtn").hover(function(){
        $(this).css("background-color","#1E9FFF");// 鼠标悬浮时触发
        $(this).css("color","white");// 鼠标悬浮时触发

        $(".newBtn").css("background-color","unset");
        $(".newBtn").css("color","unset");

        $("#monthList").css("display","block");
        $("#newList").css("display","none");
    })


});

$(function () {

    initLayPage();

})

function QQGroup() {
    window.open("https://qm.qq.com/cgi-bin/qm/qr?k=4xu14GnnvtoZxCLYD5BMEsMPGbsZmjYs&jump_from=webapi&authKey=v9FtXGBRzSX7fCd10gOvItC20it6V5uSNAMQY9oJ4tmUatdTGM727zCVJBY07QDb","_black");
}
function QQGroup2() {
    window.open("//shang.qq.com/wpa/qunwpa?idkey=730e04cd5c2db9a289ed7b6ea9d2891e5baeee8017e63f80d494b9b1ba4886e5","_black");
}

function appdown() {
    window.open("/goDownload","_black");
}


function initLayPage() {

            layui.use(['element','laypage', 'layer'], function(){
                var element = layui.element;
                var laypage = layui.laypage
                    ,layer = layui.layer;

                var pageData = $("#pageData").val();
                var page = JSON.parse(pageData);

                laypage.render({
                    elem: 'page'
                    ,count: page.count
                    ,curr:page.page
                    ,limit:page.limit
                    ,theme: '#1E9FFF'
                    ,jump:function (obj,first) {
                        //首次不执行
                        if(!first){
                            location.href = "/index?page="+obj.curr+"&limit="+obj.limit;
                        }
                    }
                });
            });
}




/**
 * 查看文章详情页面
 * @param id
 */
function  desc(id,type) {
    if("B"  == type){
        //包赔项目
        location.href = "/article/baopei_desc/0/"+id;
    }else{
        //非包赔项目
        location.href = "/article/"+id;
    }
}




